#pragma once
#include <algorithm>
#include <initializer_list>

class vector
{
public:
    explicit vector(int s) : _sz(s), _elem(new double[s]{0}) {}
    vector(const vector &v) : _sz(v._sz), _elem(new double[_sz])
    {
        std::copy(v._elem, v._elem + _sz, _elem);
    }
    vector(std::initializer_list<double> lst) : _sz(lst.size()), _elem(new double[_sz])
    {
        std::copy(lst.begin(), lst.end(), _elem);
    }
    vector(vector &&v);
    ~vector() { delete[] _elem; }
    vector &operator=(const vector &v);
    vector &operator=(vector &&v);
    int size() const { return _sz; }
    double &operator[](int i) { return _elem[i]; }
    double operator[](int i) const { return _elem[i]; }

private:
    int _sz;
    double *_elem;
};